package com.zzh.partnersys.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zzh.partnersys.entity.UserDO;
import com.zzh.partnersys.entity.dto.UserTDO;
import com.zzh.partnersys.entity.vo.UserAvaGenVO;
import org.springframework.scheduling.annotation.Async;

import jakarta.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * ???????????
 * </p>
 *
 * @author zzh
 * @since 2024-07-13
 */
public interface UserService extends IService<UserDO> {
    /**
     * ����ע��
     *
     * @param email ����
     * @param password ����
     * @param code ��֤��
     * @return �˻�
     */
    public String userRegisterEmail(String email , String password , String code);

    /**
     * ?????? ????????
     *
     * @param phone  ?????
     * @param userPassword ???????
     * @param code         ?????
     * @return ????????????
     */
    public String userRegisterPhone(String phone, String userPassword, String code);

    /**
     * ????????????
     *
     * @param userAccount   ??????
     * @param userPassword  ???????
     * @param checkPassword ��??????
     * @return ?????id
     */
    public long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * ??????
     *
     * @param userAccount  ??????
     * @param userPassword ???????
     * @param request      ????
     * @return ?????????????
     */
    public UserDO userLoginAccount(String userAccount, String userPassword, HttpServletRequest request);


    /**
     * ???????��?,?????????????????SQL???)
     * @param tagNameList ????????��?
     * @return
     */
    public List<UserDO> searchUsersByTagsBySQL(List<String> tagNameList);

    /**
     * ???????��?,???????????????????�]?)
     * @param tagNameList ????????��?
     * @return
     */
    public List<UserDO> searchUsersByTagsByCache(List<String> tagNameList);

    /**
     * @param username ?????
     * @param request ???????
     * @return ????��?
     * @description ??????????????????????????
     */
    public List<UserDO> searchUsers(String username, HttpServletRequest request);


    /**
     * ??????????��???????????????????????????
     *
     * @param request ????
     * @return ?????????
     */
    public boolean isAdmin(HttpServletRequest request);


    /**
     * ??????????
     * @param request
     * @return
     */
    public boolean userLogout(HttpServletRequest request);


    /**
     * ??????????(?????��????)
     * @param originUserDO
     * @return
     */
    public UserDO getSafeUser(UserDO originUserDO);


    /**
     * 更新用户信息
     * @param user 请求对象
     * @param currentUserDO 当前用户
     * @return boolean
     */
    public boolean updateUser(UserTDO user, UserDO currentUserDO, HttpServletRequest request);

    /**
     * ?????????
     * @param request
     * @return
     */
    UserDO getCurrentUser(HttpServletRequest request);

    /**
     * 获取当前用户
     * @param userId 用户ID
     * @return UserDO
     */
    UserDO getCurrentUserById(Long userId);

    /**
     * ???????????��??????
     * @return
     */
    public List<UserDO> getRecommendUserList(long limitLong, long pageSize, HttpServletRequest request);

    /**
     * ??????(???????????)
     * @param num
     * @param currentUserDO
     * @return
     */
    List<UserDO> matchUserListDistance(long num, UserDO currentUserDO);


    /**
     * �����¼
     * @param email ����
     * @param code ��֤��
     * @param request �������
     * @return �˻�
     */
    UserDO userLoginEmail(String email, String code, HttpServletRequest request);


    /**
     * ????????
     * @param phone
     * @param code
     * @param request
     * @return
     */
    public UserDO userLoginPhone(String phone, String code, HttpServletRequest request);

    /**
     * ?????��?tags??????????????????
     * @param tagNameList
     * @param request
     * @return
     */
    void updateUserTagsAndGender(List<String> tagNameList,Integer gender , HttpServletRequest request);

    /**
     * ?????????????url
     * @param url
     * @param request
     */
    void updateUserAvatarUrl(String url, HttpServletRequest request);


    /**
     * ???????idList?????????????
     * @param idList
     * @return
     */
    List<UserAvaGenVO> selectAvatarUrlAndGender(List<Long> idList);

    /**
     * ????????id??????
     * @param id
     * @return
     */
    UserDO selectUserById(Long id);

    /**
     * ??????????????��?
     * @param account
     * @return
     */
    List<UserDO> selectUserByAccount(String account);

    /**
     * ????id?��???????��?
     * @param idList
     * @return
     */
    List<UserDO> selectUsersByIds(List<Long> idList);

    // ��ȡ�û�����λ��
    @Async
    public void geoLocation(long userId, HttpServletRequest request) throws InterruptedException;
}
